Skip to content

feat: waiting-for-input detection and resolved state for tmux sessions#175

Closed
snibbor2 wants to merge 4 commits intoYeachan-Heo:devfrom
snibbor2:feat/waiting-for-input
Closed

feat: waiting-for-input detection and resolved state for tmux sessions#175
snibbor2 wants to merge 4 commits intoYeachan-Heo:devfrom
snibbor2:feat/waiting-for-input

Conversation

@snibbor2
Copy link
Copy Markdown

@snibbor2 snibbor2 commented Apr 8, 2026

Summary

Adds automatic detection when a monitored tmux session is blocked waiting for user input — prompts, password fields, `[y/n]` confirmations, Claude Code tool-approval dialogs, etc. — and delivers an alert to the configured Discord channel. When input is provided and the session resumes, a resolved notification is sent.

  • Detects 30+ interactive prompt patterns across the last 3 non-empty pane lines
  • Fires `tmux.waiting_for_input` event on transition from active → blocked
  • Fires resolved notification on transition from blocked → active
  • Integrates with dashboard pinning (`pin_alerts = true`) to edit the alert in-place rather than flooding the channel

Config example

[[monitors.tmux.sessions]]
session = "my-agent"
detect_waiting = true
channel = "1234567890"

Detected patterns include

  • `[y/n]`, `(y/n)`, `[yes/no]` confirmation prompts
  • `password:`, `passphrase:`, `enter password`
  • `press enter`, `press any key`
  • Claude Code / OMC tool-approval: `allow, deny`, `allow this action`, `always allow`, `approve or deny`
  • Interactive menu selectors (`❯` prefix or `? ` suffix)
  • SSH/sudo credential prompts

Three regression tests added for this case.

Test plan

  • `cargo test` — 340 tests passing (branch total)
  • Live integration tested: `read -p "Confirm? [y/n]: "` triggered alert within one poll cycle; typing `y` produced `✅ session — Input received, continuing...` edited into the alert slot within 10 seconds
  • `sudo` password prompt detected and resolved correctly
  • No false-positives during rapid continuous output

snibbor and others added 4 commits April 8, 2026 19:40
Add detect_waiting config option that monitors tmux panes for interactive
prompts (Y/n, tool approval, password, etc.) and emits waiting_for_input /
waiting_resolved events to Discord. Includes mention_on filtering for
selective @mention routing.
After a user answers a [y/n] or read prompt, the answered line remains
visible in the tmux capture-pane scrollback. The previous detection logic
checked the last 3 non-empty lines for waiting patterns, which caused the
session to stay locked in waiting state even after input was provided.

Fix: skip multiline pattern matches when the matched line is not the last
non-empty line and the last line looks like a completed shell prompt
(e.g. "user@host:~/dir$ "). This covers the common case where the answered
prompt line sits one or two lines above the new shell prompt.

Adds three regression tests covering:
- [y/n] prompt answered, shell prompt on last line → not waiting
- unanswered [y/n] prompt on last line → still detected
- read -p prompt answered, shell prompt on last line → not waiting
- Add is_infrastructure_failure() helper to distinguish 5xx/network errors
  from Discord API policy rejections (4xx)
- Gate circuit breaker record_failure on infrastructure failures only,
  preventing 404/30046/429 responses from tripping the breaker

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sion end

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@snibbor2 snibbor2 force-pushed the feat/waiting-for-input branch from 0b20dd2 to cb0e0b1 Compare April 8, 2026 23:41
@Yeachan-Heo
Copy link
Copy Markdown
Owner

Thanks for the draft. I'm closing this for now instead of leaving it open in draft limbo. Waiting-for-input detection is promising, but it still needs to come back as a merge-ready update on top of current dev with the final review/verification pass rather than sitting open as a draft. Please reopen or resubmit when it is refreshed and ready for final review.


[repo owner's gaebal-gajae (clawdbot) 🦞]

@Yeachan-Heo Yeachan-Heo closed this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants